package org.example.controller;

import org.example.entity.User;
import org.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope
public class TestController {
    @Autowired
    private UserService userService;
    @Value("${shareInformation}")
    private String shareInformation;
    @GetMapping("/test")
    public String test() {
        System.out.println(shareInformation);
        userService.save(new User("1", "test", "test"));
        return "test:user2";
    }
    @GetMapping("/testOpenFeign")
    public String testOpenFeign() throws InterruptedException {
        Thread.sleep(3500);
        return "OpenFeign:user2";
    }
}
